package cn.iocoder.yudao.module.ems.dal.mysql.maintainstandard;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ems.dal.dataobject.maintainstandard.MaintainStandardDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ems.controller.admin.maintainstandard.vo.*;

/**
 * 保养标准 Mapper
 *
 * @author 左达成
 */
@Mapper
public interface MaintainStandardMapper extends BaseMapperX<MaintainStandardDO> {

    default PageResult<MaintainStandardDO> selectPage(MaintainStandardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaintainStandardDO>()
                .likeIfPresent(MaintainStandardDO::getName, reqVO.getName())
                .eqIfPresent(MaintainStandardDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(MaintainStandardDO::getEquipmentIds, reqVO.getEquipmentIds())
                .eqIfPresent(MaintainStandardDO::getTypeIds, reqVO.getTypeIds())
                .eqIfPresent(MaintainStandardDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MaintainStandardDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(MaintainStandardDO::getId));
    }

    default List<MaintainStandardDO> selectList(MaintainStandardExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MaintainStandardDO>()
                .likeIfPresent(MaintainStandardDO::getName, reqVO.getName())
                .eqIfPresent(MaintainStandardDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(MaintainStandardDO::getEquipmentIds, reqVO.getEquipmentIds())
                .eqIfPresent(MaintainStandardDO::getTypeIds, reqVO.getTypeIds())
                .eqIfPresent(MaintainStandardDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MaintainStandardDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(MaintainStandardDO::getId));
    }

    default List<MaintainStandardDO> selectList(MaintainStandardListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MaintainStandardDO>()
                .likeIfPresent(MaintainStandardDO::getName, reqVO.getName())
                .eqIfPresent(MaintainStandardDO::getStatus, reqVO.getStatus()));
    }


}
